#define _CRT_SECURE_NO_WARNINGS 1

// https://leetcode.cn/problems/middle-of-the-linked-list/

struct ListNode {
    int val;
    struct ListNode* next;
};
typedef struct ListNode ListNode;

ListNode* MiddleNode(ListNode* head) {
    ListNode* slow = head,
        * quick = head;
    while (quick && quick->next) {
        slow = slow->next;
        quick = quick->next->next;
    }
    return slow;
}